import request from "@/utils/request";

/**
 * 签约主体列表
 * @param { ContractingPartyListParams } params
 * @returns { ContractingPartyData }
 */
export const signPageList = params =>
  request({
    url: "/contract/sign/pageList",
    method: "get",
    params
  });

/**
 * 签约主体列表不分页
 * @param { object } params
 * @param { boolean } params.status
 * @param { string } params.name
 * @returns{ContractingPartyItem[]}
 */
export const signList = params =>
  request({
    url: "/contract/sign/list",
    method: "get",
    params
  });

/**
 * 签约主体详情
 * @param { number } id
 * @returns { ContractingPartyParams }
 */
export const signDetail = id =>
  request({
    url: `/contract/sign/detail/${id}`,
    method: "get"
  });

/**
 * 新增签约主体
 * @param { ContractingPartyParams } data
 */
export const addSign = data =>
  request({
    url: "/contract/sign/create",
    method: "post",
    data
  });

/**
 * 编辑签约主体
 * @param { ContractingPartyParams } data
 * @param { number } id
 */
export const editSign = (data, id) =>
  request({
    url: `/contract/sign/update/${id}`,
    method: "put",
    data
  });

/**
 * 设置签约主体状态
 * @param { number } id
 * @param { boolean } status
 */
export const setSignStatus = (id, status) =>
  request({
    url: `/contract/sign/${id}/${status}`,
    method: "put"
  });
/**
 * 认证
 * @param { ContractingPartyParams } data
 */
export const authentication = data =>
  request({
    url: "/contract/sign_contract/authentication",
    method: "post",
    data
  });
/**
 * 授权
 * @param { ContractingPartyParams } data
 */
export const sealAuth = data =>
  request({
    url: "/contract/sign_contract/seal_auth",
    method: "post",
    data
  });
